package com.dwxt.cdms.controller;

import com.dwxt.cdms.service.WarningService;
import com.dwxt.cdms.view.WarningView;
import com.dwxt.cdms.vo.SelectWaringVo;
import com.dwxt.common.base.BaseResult;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 预警Controller
 *
 * @author Kuang.JiaZhuo
 * @date 2020-09-24 16:33
 */
@RequestMapping("/cdms/warning")
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WarningController {

    private final WarningService warningService;

    /**
     * @方法名：selectWarningByPage
     * @描述： 按条件查询预警列表(带分页)
     * @作者： kjz
     * @日期： Created in 2020/9/24 17:26
     */
    @RequestMapping("/selectWarningByPage")
    public BaseResult selectWarningByPage(SelectWaringVo selectWaringVo) {
        PageInfo<WarningView> pageInfo = warningService.selectWarningByPage(selectWaringVo);
        return  BaseResult.ok(pageInfo);
    }

    /**
     * @方法名：updateStateById
     * @描述： 更新预警的处理状态
     * @作者： kjz
     * @日期： Created in 2020/9/28 10:32
     */
    @RequestMapping("/updateStateById")
    public BaseResult updateStateById(String id,String conduct){
        return BaseResult.ok(warningService.updateStateById(id,conduct));
    }




}
